package com.tiandang;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import tiandang.core.Core;

import javax.servlet.MultipartConfigElement;

@Configuration
@Import(Core.class)
@ComponentScan
@EnableAutoConfiguration
public class SiteApplication {

  @Bean
  MultipartConfigElement multipartConfigElement() {
    MultipartConfigFactory factory = new MultipartConfigFactory();
    factory.setMaxFileSize("5MB");
    factory.setMaxRequestSize("5MB");
    return factory.createMultipartConfig();
  }

  public static void main(String[] args) {
    SpringApplication.run(SiteApplication.class, args);
  }
}
